package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.admin.vo.SiteListVO;
import org.jsola.core.Result;
import org.jsola.hr.dto.PhoneVerificationCodeDTO;
import org.jsola.hr.dto.RecruitXcxLoginByPhoneDTO;
import org.jsola.hr.dto.RecruitXcxLoginDTO;
import org.jsola.hr.dto.WeChatBindFromOffAccountDTO;
import org.jsola.hr.vo.EmpAllInfoVO;
import org.jsola.hr.vo.EmpLoginResultVO;
import org.jsola.hr.vo.RecruitResultVO;
import org.jsola.hr.vo.WeChatSiteBindVO;
import org.jsola.user.dto.RecruitWechatXcxLoginDTO;
import org.jsola.user.dto.login.WechatWebLoginDTO;
import org.jsola.user.dto.login.WechatXcxLoginDTO;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import java.util.List;

/**
 * @author JanusMix
 */
@Api(tags = "hr-登录")
public interface ILoginControllerAPI {

    /**
     * 微信小程序登录
     *
     * @param wechatXcxLoginDTO wechatXcxLoginDTO
     * @return UserLoginVO
     */
    @ApiOperation(value = "微信小程序登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "deviceType", value = "设备类型", dataType = "String", paramType = "header"),
            @ApiImplicitParam(
                    name = "wechatXcxLoginDTO",
                    value = "微信小程序登录",
                    dataType = "WechatXcxLoginDTO",
                    paramType = "body"
            )
    })
    Result<EmpLoginResultVO> wechatXcxLogin(WechatXcxLoginDTO wechatXcxLoginDTO);

    /**
     * 微信管理端小程序登录
     *
     * @param wechatXcxLoginDTO wechatXcxLoginDTO
     * @return UserLoginVO
     */
    @ApiOperation(value = "微信管理端小程序登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "deviceType", value = "设备类型", dataType = "String", paramType = "header"),
            @ApiImplicitParam(
                    name = "wechatXcxLoginDTO",
                    value = "微信小程序登录",
                    dataType = "WechatXcxLoginDTO",
                    paramType = "body"
            )
    })
    Result<EmpLoginResultVO> wechatXcxLoginForAdmin(WechatXcxLoginDTO wechatXcxLoginDTO);

    /**
     * 解析获取手机号
     *
     * @param wechatXcxLoginDTO 小程序信息
     * @return 用户手机号
     */
    @ApiOperation(value = "微信小程序登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wechatXcxLoginDTO", value = "WechatXcxLoginDTO", dataType = "小程序信息", paramType = "body")
    })
    Result<String> getPhone(WechatXcxLoginDTO wechatXcxLoginDTO);

    /**
     * 解析登录信息 通过微信授权手机号
     *
     * @param recruitXcxLoginDTO 小程序信息
     * @return 用户手机号
     */
    @ApiOperation(value = "解析登录信息 通过微信授权手机号")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "recruitXcxLoginDTO", value = "RecruitXcxLoginDTO", dataType = "小程序信息", paramType = "body"),
            @ApiImplicitParam(name = "unionId", value = "RecruitXcxLoginDTO", dataType = "微信unionId", paramType = "path")
    })
    Result<RecruitResultVO> getPhone2(RecruitXcxLoginDTO recruitXcxLoginDTO, String unionId);

    /**
     * 解析登录信息 通过手机号验证码
     *
     * @param recruitXcxLoginByPhoneDTO 小程序信息
     * @return 用户手机号
     */
    @ApiOperation(value = "解析登录信息 通过手机号验证码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "recruitXcxLoginByPhoneDTO", value = "RecruitXcxLoginByPhoneDTO", dataType = "小程序信息", paramType = "body"),
            @ApiImplicitParam(name = "unionId", value = "RecruitXcxLoginDTO", dataType = "微信unionId", paramType = "path")
    })
    Result<RecruitResultVO> getPhoneAndCaptcha(RecruitXcxLoginByPhoneDTO recruitXcxLoginByPhoneDTO, String unionId);

    /**
     * 招聘微信小程序登录
     *
     * @param recruitWechatXcxLoginDTO wechatXcxLoginDTO
     * @return UserLoginVO
     */
    @ApiOperation(value = "微信小程序登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "recruitWechatXcxLoginDTO"
                    , value = "小程序信息", dataType = "RecruitWechatXcxLoginDTO", paramType = "body")
    })
    @Deprecated
    Result<RecruitResultVO> wechatRecruitLogin(RecruitWechatXcxLoginDTO recruitWechatXcxLoginDTO);

    /**
     * 招聘微信小程序登录2.0 先授权 无手机号注册再授权手机号
     *
     * @param recruitWechatXcxLoginDTO wechatXcxLoginDTO
     * @return UserLoginVO
     */
    @ApiOperation(value = "微信小程序登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "recruitWechatXcxLoginDTO"
                    , value = "小程序信息", dataType = "RecruitWechatXcxLoginDTO", paramType = "body")
    })
    Result<RecruitResultVO> wechatRecruitLogin2(RecruitWechatXcxLoginDTO recruitWechatXcxLoginDTO);

    /**
     * 微信web扫码登录
     *
     * @param wechatWebLoginDTO wechatWebLoginDTO
     * @return UserLoginVO
     */
    @ApiOperation(value = "微信web扫码登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "deviceType", value = "设备类型", dataType = "String", paramType = "header"),
            @ApiImplicitParam(
                    name = "wechatWebLoginDTO",
                    value = "微信web扫码登录信息",
                    dataType = "WechatWebLoginDTO",
                    paramType = "body"
            )
    })
    Result<EmpLoginResultVO> wechatWebLogin(WechatWebLoginDTO wechatWebLoginDTO);

    /**
     * 根据token查询员工用户相关信息
     *
     * @return 员工用户相关信息
     */
    @ApiOperation(value = "根据token查询员工用户相关信息")
    Result<EmpAllInfoVO> getEmpAllInfoByToken();

    /**
     * 根据token查询员工用户相关信息，包括离职
     *
     * @return 员工用户相关信息
     */
    @ApiOperation(value = "根据token查询员工用户相关信息，包括离职")
    Result<EmpAllInfoVO> getEmpAllInfoByToken2();

    /**
     * 根据手机号查询员工所有站点ID集合
     *
     * @return 员工所有站点集合
     */
    @ApiOperation(value = "根据手机号查询员工所有站点ID集合")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "phone", dataType = "String", value = "手机号", paramType = "query")
    })
    Result<List<String>> getSiteIdListByPhone(String phone);

    /**
     * 根据手机号查询员工所有站点VO集合
     *
     * @return 员工所有站点集合
     */
    @ApiOperation(value = "根据手机号查询员工所有站点VO集合")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "phone", dataType = "String", value = "手机号", paramType = "query")
    })
    Result<List<SiteListVO>> getSiteListVOByPhone(String phone);

    /**
     * 从公众号跳转小程序绑定微信信息
     *
     * @param weChatBindFromOffAccountDTO 手机号
     * @return 更新数量
     */
    @ApiOperation(value = "从公众号跳转小程序绑定微信信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "weChatBindFromOffAccountDTO", dataType = "WeChatBindFromOffAccountDTO", value = "公众号跳转小程序绑定微信的参数", paramType = "body")
    })
    Result<Boolean> bindWeChatFromOfficialAccount(@Valid @RequestBody WeChatBindFromOffAccountDTO weChatBindFromOffAccountDTO);

    /**
     * 验证微信unionId绑定企业信息
     *
     * @param unionId unionId
     * @return 更新数量
     */
    @ApiOperation(value = "验证微信unionId绑定企业信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "unionId", dataType = "String", value = "验证微信号绑定企业信息", paramType = "query")
    })
    Result<WeChatSiteBindVO> checkBindByUnionId(String unionId);


    /**
     * 校验验证码
     *
     * @param phoneVerificationCodeDTO 校验验证码
     * @return EmpInfoVO
     */
    @ApiOperation(value = "短信验证码登录（微信小程序登录失败跳转）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "phoneVerificationCodeDTO", value = "手机号验证码ticketDTO", dataType = "PhoneVerificationCodeDTO", paramType = "body")
    })
    Result<String> verifyCaptcha(PhoneVerificationCodeDTO phoneVerificationCodeDTO);

}
